﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MainLayout.master" AutoEventWireup="false" CodeFile="staffentry.aspx.vb" Inherits="staffentry" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1>
        Staff Management</h1>
    <hr />
    <asp:Label ID="lblStaffUID" runat="server" Visible="false" />
   <div  runat="server" id="divError" class="msg-box-error" visible="false" enableviewstate="false">
    
        <span class="title">Error</span><br />
        <asp:Label ID="lblMsgError" runat="server" Text="ERROR" />
        </div>
<div  runat="server" id="divSuccessful" class="msg-box-success" visible="false" enableviewstate="false">
    
        <span class="title">Successful</span><br />
        <asp:Label ID="lblMsgSuccessful" runat="server" Text="Success" />
    
</div>
    <p><%--Description of the page--%></p>
    <div class="form-container" id="divContentGeneral">
        <table width="100%"><tr><td class="General-info-title" style="width:150px;"><h3>General Information</h3></td><td><div class="General-info-title-line"></div></td></tr></table>
        <table class="form-table" cellpadding="5" cellspacing="5">
            <tr>
                <th scope="row" style="width: 200px">
                    Username :
                </th>
                <td>
                    <asp:TextBox ID="txtUsername" runat="server" Width="300px" />
                    <span style="color: Red">*<asp:RequiredFieldValidator ID="rfvtxtUsername" ControlToValidate="txtUsername"
                        SetFocusOnError="true" runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a Username"
                        ForeColor="Red" Display="Dynamic" />
                        <asp:Label ID="lblExistUsernameError" runat="server" ForeColor="Red" /><asp:Button
                            ID="btnVerify" runat="server" Text="Verify" Style="display: none" />
                    </span>
                </td>
                <td rowspan="6" valign="bottom" width="150" align="center">
                    <div>
                        <asp:Image ID="imgAvatar" runat="server" Width="150" Height="200" /></div>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Password :
                </th>
                <td>
                    <asp:TextBox ID="txtPassword" runat="server" Width="300px" TextMode="Password" />
                    <span style="color: Red">*
                        <asp:RequiredFieldValidator ID="rfvtxtPassword" ControlToValidate="txtPassword"
                            runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a Password"
                            ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                        <%--<asp:CompareValidator ID="cpvtxtPassword" ControlToCompare="txtReType" ControlToValidate="txtPassword" SetFocusOnError="true" runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Password not match" ForeColor="Red" Display="Dynamic" />--%>
                    </span>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Retype Password :
                </th>
                <td>
                    <asp:TextBox ID="txtReType" runat="server" Width="300px" TextMode="Password" />
                    <span style="color: Red">*<asp:CompareValidator ID="cpvtxtReType" ControlToCompare="txtReType"
                        ControlToValidate="txtPassword" runat="server" ValidationGroup="staffentry"
                        ErrorMessage="<br />Password not match" ForeColor="Red" 
                        Display="Dynamic"  CssClass="ErrorMsg"/></span>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Name :
                </th>
                <td>
                    <asp:TextBox ID="txtName" runat="server" Width="300px" />
                    <span style="color: Red">*<asp:RequiredFieldValidator ID="rfvtxtName" ControlToValidate="txtName"
                        SetFocusOnError="true" runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a name"
                        ForeColor="Red" Display="Dynamic" /></span>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Initial :
                </th>
                <td>
                    <asp:TextBox ID="txtInitial" runat="server" Width="300px" />
                    <span style="color: Red">*
                        <asp:RequiredFieldValidator ID="rfvtxtInitial" ControlToValidate="txtInitial" SetFocusOnError="true"
                            runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter an initial"
                            ForeColor="Red" Display="Dynamic" />
                    </span>
                </td>
            </tr>
           <tr>
                <th scope="row" style="width: 200px">
                    REN :
                </th>
                <td>
                    <asp:TextBox ID="txtRen" runat="server" Width="300px" MaxLength="15" >0</asp:TextBox>
                    <span style="color: Red">*
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtRen" SetFocusOnError="true"
                            runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter an REN. Put 0 if don't have."
                            ForeColor="Red" Display="Dynamic" />
                    </span>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Staff Type :
                </th>
                <td>
                    <asp:DropDownList ID="ddlStaffType" runat="server">
                        <asp:ListItem Text="-SELECT-" Value="" Selected="True" />
                        <asp:ListItem Text="Boss" Value="1" />
                        <asp:ListItem Text="REN" Value="2" />
                        <asp:ListItem Text="Administrator" Value="3" />
                        <asp:ListItem Text="Probation" Value="4" />
                        <asp:ListItem Text="Receptionist" Value="5" />
                        <asp:ListItem Text="Account" Value="6" />
                        <asp:ListItem Text="Part-time" Value="7" />
                    </asp:DropDownList>
                    <span style="color: Red">*<asp:RequiredFieldValidator ID="rfvddlStaffType" ControlToValidate="ddlStaffType"
                        SetFocusOnError="true" runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please select a staff type"
                        ForeColor="Red" Display="Dynamic" />
                    </span>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Avatar :
                </th>
                <td>
                    <asp:FileUpload ID="filAvatar" runat="server" />
                    <asp:RequiredFieldValidator ID="rfvtxtAvatar" ControlToValidate="filAvatar" SetFocusOnError="true"
                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please select a an avatar"
                        ForeColor="Red" Display="Dynamic" />
                    <asp:Label ID="lblAvatarUID" runat="server" Visible="false" />
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Description (1000chars) :
                </th>
                <td>
                    <asp:TextBox ID="txtDescription" runat="server" Width="400px" MaxLength="1000" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Area (500chars) :
                </th>
                <td>
                    <asp:TextBox ID="txtArea" runat="server" Width="400px" MaxLength="499" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 200px">
                    Property Type (500chars) :
                </th>
                <td>
                    <asp:TextBox ID="txtPropertyType" runat="server" Width="400px" MaxLength="499" TextMode="MultiLine">0</asp:TextBox>
                </td>
            </tr>
        </table>
        </div>
        
    <div class="form-container" id="divContentContact">
        <table width="100%"><tr><td class="General-info-title" style="width:150px;"><h3>Contact Informations</h3></td><td><div class="General-info-title-line"></div></td></tr></table>
        <table cellpadding="5" cellspacing="5" class="form-table">
            <tr>
                <th scope="row" style="width: 200px">
                    Phone :
                </th>
                <td class="style1">
                    <asp:TextBox ID="txtPhone" runat="server" Width="300px" onkeypress="return isNumberKeyOnly(event)"
                        onpaste="return false;" />
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 150px">
                    Mobile :
                </th>
                <td class="style1">
                    <asp:TextBox ID="txtMobile" runat="server" Width="300px" onkeypress="return isNumberKeyOnly(event)"
                        onpaste="return false;" MaxLength="11" /><span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ID="rfvtxtMobile" ControlToValidate="txtMobile" SetFocusOnError="true"
                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a mobile"
                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 150px">
                    Fax :
                </th>
                <td class="style1">
                    <asp:TextBox ID="txtFax" runat="server" Width="300px" onkeypress="return isNumberKeyOnly(event)"
                        onpaste="return false;" />
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 150px">
                    Email :
                </th>
                <td class="style1">
                    <asp:TextBox ID="txtEmail" runat="server" Width="300px" /><span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ID="rfvEmail" ControlToValidate="txtEmail" SetFocusOnError="true"
                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter an email"
                        ForeColor="Red" Display="Dynamic" />
                    <asp:RegularExpressionValidator ID="revEmail" ControlToValidate="txtEmail" SetFocusOnError="true"
                        runat="server" ErrorMessage="<br/>You must enter a valid email address" ForeColor="Red"
                        ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="submitimage"
                        Display="Dynamic" CssClass="ErrorMsg" />
                </td>
            </tr>
        </table>
        
    <div class="form-container" id="divContentListing">
        <table width="100%"><tr><td class="General-info-title" style="width:150px;"><h3>Listing Configuration</h3></td><td><div class="General-info-title-line"></div></td></tr></table>
        <table cellpadding="5" cellspacing="5" class="form-table">
            <tr>
                <th scope="row" valign="middle" style="width: 200px">
                    Listing Fee Percent :
                </th>
                <td style="font-size: 12px; color: Gray; width: 429px;">
                    <asp:TextBox ID="txtListingFee" runat="server" />%
                </td>
            </tr>
            <tr>
                <th scope="row" valign="top" style="width: 150px; padding-top:20px;">
                    Volume :
                </th>
                <td style="margin-left:0px; vertical-align:top;">
                    <div>
                        <table class="form-entry-container"  id="VolumnTable">
                            <tr>
                                <th>
                                    SR
                                </th>
                                <td style="width: 200px;">
                                    <asp:TextBox ID="txtSR" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvtxtSR" ControlToValidate="txtSR" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume SR"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                                <th>
                                    RR
                                </th>
                                <td style="width: 200px;">
                                    <asp:TextBox ID="txtRR" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvtxtRR" ControlToValidate="txtRR" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume RR"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    SC
                                </th>
                                <td>
                                    <asp:TextBox ID="txtSC" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvtxtSC" ControlToValidate="txtSC" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume SC"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                                <th>
                                    RC
                                </th>
                                <td>
                                    <asp:TextBox ID="txtRC" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvtxtRC" ControlToValidate="txtRC" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume RC"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    SL
                                </th>
                                <td style="width: 150px">
                                    <asp:TextBox ID="txtSL" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvtxtSL" ControlToValidate="txtSL" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume SL"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                                <th>
                                    RL
                                </th>
                                <td>
                                    <asp:TextBox ID="txtRL" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvRL" ControlToValidate="txtRL" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume RL"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    SI
                                </th>
                                <td style="width: 150px">
                                    <asp:TextBox ID="txtSI" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvtxtSI" ControlToValidate="txtSI" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume SI"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                                <th>
                                    RI
                                </th>
                                <td>
                                    <asp:TextBox ID="txtRI" runat="server" Width="140px" onkeypress="return isNumberKey(event)"
                                        onpaste="return false;" /><span style="color: Red">*</span>
                                    <asp:RequiredFieldValidator ID="rfvRI" ControlToValidate="txtRI" SetFocusOnError="true"
                                        runat="server" ValidationGroup="staffentry" ErrorMessage="<br />Please enter a volume RI"
                                        ForeColor="Red" Display="Dynamic" CssClass="ErrorMsg"/>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
            <tr>
                <th scope="row" style="width: 150px">
                    Commission :
                </th>
                <td style="font-size: 12px; color: Gray; width: 429px;">   
                    <asp:UpdatePanel ID="udpCommission" runat="server">
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnAddCommission" EventName="Click" />
                                </Triggers>
                                <ContentTemplate>
                                <table>                        
                                    <tr>
                                        <th width="160px">
                                            Amount From
                                        </th>
                                        <th width="160px">
                                            Amount To
                                        </th>
                                        <th width="160px">
                                            Commission (%)
                                        </th>
                                        <th>
                                        </th>
                                        <th>
                                        </th>
                                    </tr>        
                                    <asp:Repeater ID="repCommission" runat="server">
                                        <ItemTemplate>
                                            <tr>
                                                <td width="160px">
                                                    <asp:Label ID="lblhidRepCommissionId" runat="server" Visible="false" Text='<%#Container.dataitem("CommissionId").tostring %>' />
                                                    <asp:Label ID="lblhidRepStatus" runat="server" Visible="false" Text='<%#Container.dataitem("Status").tostring %>' />
                                                    <asp:Label ID="lblhidRepVisible" runat="server" Visible="false" Text='<%#Container.dataitem("Visible").tostring %>' />
                                                    <asp:LinkButton ID="lbtRepAmountFrom" runat="server" Text='<%#Bind("AmountFrom","{0:#,##0.00}") %>'
                                                        Style="text-decoration: none" CommandName="Edit" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' />
                                                    <asp:TextBox ID="txtRepAmountFrom" runat="server" Text='<%#Bind("AmountFrom","{0:#,##0.00}") %>'
                                                        visible="false" />
                                                </td>
                                                <td width="160px">
                                                    <asp:LinkButton ID="lbtRepAmountTo" runat="server" Text='<%#Bind("AmountTo","{0:#,##0.00}") %>'
                                                        Style="text-decoration: none" CommandName="Edit" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' />
                                                    <asp:TextBox ID="txtRepAmountTo" runat="server" Text='<%#Bind("AmountTo","{0:#,##0.00}") %>'
                                                        visible="false" />
                                                </td>
                                                <td width="160px">
                                                    <asp:LinkButton ID="lbtRepCommission" runat="server" Text='<%#Bind("Commission","{0:#,##0.00}") %>'
                                                        Style="text-decoration: none" CommandName="Edit" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' />
                                                    <asp:TextBox ID="txtRepCommission" runat="server" Text='<%#Bind("Commission","{0:#,##0.00}") %>'
                                                        visible="false" />
                                                </td>
                                                <td>
                                                    <asp:Button ID="btnMinusCommission" runat="server" Text="-" CommandName="Minus" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' />
                                                    <asp:Button ID="btnSaveCommission" runat="server" Text="Save" visible="false"
                                                        CommandName="Save" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' />
                                                </td>
                                                <td>
                                                    <asp:Button ID="btnCancelCommission" runat="server" Text="Cancel" visible="false"
                                                        CommandName="Cancel" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex") %>' />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                    </table>    
                                    <table>
                                        <tr>
                                            <td width="160px"><asp:TextBox ID="txtAmountFrom" runat="server" /></td>
                                            <td width="160px"><asp:TextBox ID="txtAmountTo" runat="server" /></td>
                                            <td width="160px"><asp:textbox ID="txtCommission" runat="server" /></td>
                                            <td><asp:Button ID="btnAddCommission" runat="server" Text="+" /></td>
                                        </tr> 
                                    </table>                                
                                </ContentTemplate>
                            </asp:UpdatePanel>  
                            <asp:UpdateProgress ID="upgCommision" runat="server" AssociatedUpdatePanelID="udpCommission">
                                <ProgressTemplate>
                                    <div style="top:0px; position:fixed; width:100%; text-align:center">
                                        <span style="background-color:Yellow; font-weight:bold">Loading ...</span>
                                    </div>
                                </ProgressTemplate>
                            </asp:UpdateProgress>                                
                </td>
            </tr>
        </table>
        
    
    <div class="Confirmation-Container">
        <table width="100%" style="margin-left:0px;">
                        <tr>
                            <td><div class="General-info-title-line"></div></td>
                            <td style="width:170px;"> 
                                &nbsp;<asp:Button ID="btnBack" runat="server" Text="Back"  CssClass="search-btn" Width="60" />&nbsp;
                                <asp:Button ID="BtnSave" runat="server" Text="Save" ValidationGroup="StaffEntry" CssClass="search-btn" Width="80"/>
                                &nbsp;<cc1:ConfirmButtonExtender ID="CBEBack" runat="server" TargetControlID="btnBack" />
                            </td>
                            <td style="width: 60px"><div class="General-info-title-line"></div></td>
                        </tr>
                    </table>
                    <div class=" form-entry-title" style="line-height:15px; margin-bottom:0px; margin-top:15px;"><span style="color: Red; font-size:10px;">*Required fields</span></div>
    </div>

    <script language="javascript" type="text/javascript">
     function IsUserNameExist() {
         var btn = document.getElementById('<%=btnVerify.ClientId %>');
         btn.click();
     }         
    </script>

    </div>
    </div>
</asp:Content>
